import 'package:flutter/material.dart';
import '../model/playing_card.dart';
import '../model/ex_stream.dart';

class GesturePlayingCard extends StatelessWidget {
  final PlayingCard card;
  Widget cardWidget;
  final ExStream<bool> triggerWaitStream;
  GesturePlayingCard({@required this.card, @required this.triggerWaitStream}) {
    this.cardWidget = this.card.getCard();
  }

  @override
  Widget build(BuildContext context) {
    return StreamBuilder<bool>(
      stream: triggerWaitStream.stream,
      initialData: triggerWaitStream.data,
      builder: (BuildContext context, AsyncSnapshot<bool> data) {
        return data.data ? Transform(
          transform: Matrix4.translationValues(0, -10, 0),
          child: this.cardWidget
        ) : this.cardWidget;
      },
    );
  }
}